<?php session_start(); ?>
<?php 
 include "./smss_connect.php";
  include "tab.php";
  	/* update*/
 					    $yearb=$_REQUEST[yearb];
						$termb=$_REQUEST[termb];
						$idB;

			if($checkU=="U")
			{
				/* set 0 all*/
				$sqlU="	UPDATE  health_base
							SET		
								status='0'								
							WHERE	base_id
							";
						$resultU=@mysql_db_query($dbname,$sqlU);
					/*set 1*/	
							$sqlU2="	UPDATE  health_base
							SET		
								status='1'
								
							WHERE	base_id='$idB'
							LIMIT	1	";
						$resultU2=@mysql_db_query($dbname,$sqlU2);
				}
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ข้อมูลพื้นฐาน</title>
<link rel='stylesheet' href='modules/health/css_health.css'>
</head>
<script>
function checkfof(form1){
	
					if (form1.yearb.value == ""){
				alert('กรอก ปีการศึกษา');
					return false;}
					
					if (form1.termb.value == ""){
				alert('กรอก ภาคเรียน');
					return false;}
			}
</script>
<body topmargin="0" bgcolor="#F4FFF4">
<br>


<?
				 $sqlS="SELECT* FROM health_base order by base_id desc";
		   		$resultS=@mysql_db_query($dbname,$sqlS); 
		   		
?>
<table width="500" border="0" align="center">
  <tr align="center" valign="middle" >
    <td width="54">&nbsp;</td>
    <td width="117">&nbsp;</td>
    <td width="121">&nbsp;</td>
    <td width="190">&nbsp;</td>
  </tr>
  <tr align="center" valign="middle" >
    <td width="54" bgcolor="#76CEEB" class="topbg">ลำดับ</td>
    <td width="117" bgcolor="#76CEEB" class="topbg">ปีการศึกษา</td>
    <td width="121" bgcolor="#76CEEB" class="topbg">ภาคเรียน</td>
    <td bgcolor="#76CEEB" class="topbg">สถานะใช้งาน</td>
  </tr>
  <?
 		 $Bnum=1;
		  while($recordS=@mysql_fetch_array($resultS)){
			
				$c1="#DDF4F9";
			 	$c2="#FEE2FC";
				if($bg==$c1){
				$bg=$c2;
				}else{
				$bg=$c1;
				}
  ?>
  <tr bgcolor="<?=$bg?>">
    <td align="center"><?=$Bnum?></td>
    <td align="center"><?=$recordS[1]?></td>
    <td align="center"><?=$recordS[2]?></td>
    <td align="center"><? if($recordS[3]==1)
	{
	echo"	<a href='?option=health&task=database&idB=$recordS[0]&checkU=U'><img src='modules/health/iconH/yes.png' border='0'></a>";
		}else{
		echo"	<a href='?option=health&task=database&idB=$recordS[0]&checkU=U'><img src='modules/health/iconH/no.png' border='0'></a>";
		}
	?></td>
  </tr>
  <? 
  $Bnum++;
		  }
  ?>
</table>

</body>
</html>
